package com.springcloud.util.model;

import com.itextpdf.text.Element;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;


/**
 * @Description: TODO
 * @Create by: 123
 * @Date: 2021/11/22 16:53
 */

@Data
public class HorizontalAlignment {
    private int align = com.itextpdf.text.Element.ALIGN_CENTER;

    public HorizontalAlignment(String align) {
        if (StringUtils.isNotBlank(align)) {
            switch (align) {
                case "left":
                    this.align = Element.ALIGN_LEFT;
                    break;
                case "right":
                    this.align = Element.ALIGN_RIGHT;
                    break;
                default:

            }
        }
    }

    public HorizontalAlignment(String align,int defaultValue) {
        if (StringUtils.isNotBlank(align)) {
            switch (align) {
                case "left":
                    this.align = Element.ALIGN_LEFT;
                    break;
                case "right":
                    this.align = Element.ALIGN_RIGHT;
                    break;
                default:

            }
        }else{
            this.align = defaultValue;
        }
    }
}
